﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace OneKillProcess
{
    public class InputDialog1 : Form
    {
        private TextBox textBox1;
        private Button buttonOK;
        private Button buttonCancel;

        public string Keyword { get; private set; }

        public InputDialog1()
        {
            InitializeComponent();
        }

        private void InitializeComponent()
        {
            textBox1 = new TextBox();
            buttonOK = new Button();
            buttonCancel = new Button();

            this.Text = "输入关键字";

            textBox1.Location = new System.Drawing.Point(12, 12);
            textBox1.Size = new System.Drawing.Size(200, 20);

            buttonOK.Location = new System.Drawing.Point(50, 50);
            buttonOK.Text = "确定";
            buttonOK.Click += ButtonOK_Click;

            buttonCancel.Location = new System.Drawing.Point(120, 50);
            buttonCancel.Text = "取消";
            buttonCancel.Click += ButtonCancel_Click;

            this.Controls.Add(textBox1);
            this.Controls.Add(buttonOK);
            this.Controls.Add(buttonCancel);

            this.Size = new System.Drawing.Size(250, 200);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.StartPosition = FormStartPosition.CenterParent;
        }

        private void ButtonOK_Click(object sender, EventArgs e)
        {
            Keyword = textBox1.Text;
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void ButtonCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
